

const isA = true
const isB = true
const isC = true
const isD = true

const A = () => {
    return new Promise((resolve, reject) => {
        console.log('a的逻辑');
        setTimeout(() => {
            if (isA) {
                resolve('a执行成功')
            } else {
                reject('a执行失败')
            }
        }, 1 * 1000)
    })
}
const B = () => {
    return new Promise((resolve, reject) => {
        console.log('b的逻辑');
        setTimeout(() => {
            if (isA) {
                resolve('b执行成功')
            } else {
                reject('b执行失败')
            }
        }, 1 * 1000)
    })
}
const C = () => {
    return new Promise((resolve, reject) => {
        console.log('c的逻辑');
        setTimeout(() => {
            if (isA) {
                resolve('c执行成功')
            } else {
                reject('c执行失败')
            }
        }, 1 * 1000)
    })
}
const D = () => {
    return new Promise((resolve, reject) => {
        console.log('d的逻辑');
        setTimeout(() => {
            if (isA) {
                resolve('d执行成功')
            } else {
                reject('d执行失败')
            }
        }, 1 * 1000)
    })
}
// A().then(resolve => {
//     console.log(resolve);
//     return B()
// }).catch(err => {
//     console.log(err);
// }).then(resolve => {
//     console.log(resolve);
//     return C()
// })
(async () => {
    try {
        const a = await A()
        console.log(a);
        const b = await B()
        console.log(b);
    } catch (err) {
        console.log(err);
    }
})()